
package com.x52im.rbchat.logic.contact.viewholder.foot;

import android.view.View;
import android.widget.TextView;

import com.x52im.rbchat.logic.contact.FriendListAdapter;
import com.x52im.rbchat.logic.contact.model.FooterItemValue;
import com.x52im.rbchat.R;

import androidx.fragment.app.Fragment;

public class FriendCountItemViewHolder extends FooterItemViewHolder<FooterItemValue> {
    private TextView countTextView;
    private FriendListAdapter adapter;

    public FriendCountItemViewHolder(Fragment fragment, FriendListAdapter adapter, View itemView) {
        super(fragment, adapter, itemView);
        this.adapter = adapter;
        this.countTextView = itemView.findViewById(R.id.countTextView);
    }

    @Override
    public void onBind(FooterItemValue contactCountFooterItemValue) {
        int count = adapter.getContactCount();
        if (count == 0) {
            countTextView.setText("暂无好友");
        } else {
            countTextView.setText(count + "个好友");
        }
    }
}